package com.jh3502.helper.function.bluetooth;

import com.jh3502.helper.utils.Utils;

public class BlueToothCheckCode {
    public static long check(byte[] paramArrayOfByte) {
        int i = 0;
        int j = 0;
        int k = 0;
        int m = 0;
        if ((paramArrayOfByte[3] & 0x80) != 0) {
            k |= 0x4;
        }
        if ((paramArrayOfByte[3] & 0x40) != 0) {
            k |= 0x80;
        }
        if ((paramArrayOfByte[3] & 0x20) != 0) {
            j = (byte) (j | 0x44);
        }
        if ((paramArrayOfByte[3] & 0x10) != 0) {
            k |= 0x1;
        }
        if ((paramArrayOfByte[3] & 0x8) != 0) {
            k |= 0x40;
        }
        if ((paramArrayOfByte[3] & 0x4) != 0) {
            i |= 0x4444;
        }
        if ((paramArrayOfByte[3] & 0x2) != 0) {
            k |= 0x1000;
        }
        if ((paramArrayOfByte[3] & 0x1) != 0) {
            k |= 0x200;
        }
        if ((paramArrayOfByte[4] & 0x80) != 0) {
            k |= 0x4000;
        }
        if ((paramArrayOfByte[4] & 0x40) != 0) {
            k |= 0x800;
        }
        if ((paramArrayOfByte[4] & 0x20) != 0) {
            j = (byte) (j | 0x11);
        }
        if ((paramArrayOfByte[4] & 0x10) != 0) {
            j = (byte) (j | 0x88);
        }
        if ((paramArrayOfByte[4] & 0x8) != 0) {
            k |= 0x10;
        }
        if ((paramArrayOfByte[4] & 0x4) != 0) {
            k |= 0x8000;
        }
        if ((paramArrayOfByte[4] & 0x2) != 0) {
            i |= 0x1111;
        }
        if ((paramArrayOfByte[4] & 0x1) != 0) {
            i |= 0x8888;
        }
        if ((paramArrayOfByte[1] & 0x80) != 0) {
            k |= 0x100;
        }
        if ((paramArrayOfByte[1] & 0x40) != 0) {
            j = (byte) (j | 0x22);
        }
        if ((paramArrayOfByte[1] & 0x20) != 0) {
            k |= 0x20;
        }
        if ((paramArrayOfByte[1] & 0x10) != 0) {
            i |= 0x2222;
        }
        if ((paramArrayOfByte[1] & 0x8) != 0) {
            k |= 0x2000;
        }
        if ((paramArrayOfByte[1] & 0x4) != 0) {
            k |= 0x2;
        }
        if ((paramArrayOfByte[1] & 0x2) != 0) {
            k |= 0x400;
        }
        if ((paramArrayOfByte[1] & 0x1) != 0) {
            k |= 0x8;
        }
        k ^= i;
        j = (byte) (j ^ 0x4C);
        int tmp364_363 = 2;
        paramArrayOfByte[tmp364_363] = ((byte) (paramArrayOfByte[tmp364_363] ^ j));
        int tmp372_371 = 5;
        paramArrayOfByte[tmp372_371] = ((byte) (paramArrayOfByte[tmp372_371] ^ j));
        int n;
        if (paramArrayOfByte[5] < 0) {
            n = paramArrayOfByte[5] + 256;
        } else {
            n = paramArrayOfByte[5];
        }
        n <<= 8;
        if (paramArrayOfByte[2] < 0) {
            n = n + paramArrayOfByte[2] + 256;
        } else {
            n += paramArrayOfByte[2];
        }
        n -= 13845;
        k += n;
        return k;
    }

    public static double check(String s) {
        double d;
        int i = Integer.parseInt(s, 16);
        d = Utils.getInstance().div(i, 10, 2);
        return d;
    }
}
